package com.tianlan.blog.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.tianlan.blog.entity.SysOrganizationUser;

public interface SysOrganizationUserDao extends JpaRepository<SysOrganizationUser, Long>{
	
	@Transactional
	@Modifying
	@Query(value = "UPDATE sys_organization_user SET del_flag = '1' WHERE user_id = ?1",nativeQuery = true)
	int deleteOrganizationUser(Integer userId);
	
	SysOrganizationUser findOneByUserIdAndOrganizationIdAndDelFlag(Integer userId,Integer organizationId,String delFlag);
	
	SysOrganizationUser findOneByUserIdAndDelFlag(Integer userId,String delFlag);
	
	
}
